<?php
namespace Admin\Controller;
use User\Api\UserApi;

class BidController extends AdminController{

	// 爆料列表 
	public function bidlist($p = 1){
		$bid = M('bid');

		$list = $bid->order("bid_time DESC")->page((int)$p,20)->select();
		$count = $bid->count();
		$page = new \Think\Page($count,20);
        $show = $page->show();

        $this->assign('list',$list);
        $this->assign('_page',$show);
        $this->meta_title = "爆料列表";
        $this->display();
	}

	public function bidpass($id){
		$id || $this->error('参数不足');

		if(M('bid')->save(array('id'=>$id,'bid_status'=>1))){
			$this->success("已审核通过");
		}else{
			$this->error('审核失败，请重试');
		}
	}

	public function bidignore($id){
		$id || $this->error('参数不足');

		if(M('bid')->save(array('id'=>$id,'bid_status'=>10))){
			$this->success("已忽略");
		}else{
			$this->error('操作失败，请重试');
		}
	}

	public function biddetail($id){
		$id || $this->error('参数不足');

		$info = M('bid')->find($id);
		$user = M('member')->find($info['uid']);
		if(!empty($info['bid_images'])){
			$images = explode(",",$info['bid_images']);
			$this->assign('images',$images);
			$has_image = 1;
		}else{
			$has_image = 0;
		}
		$this->assign('has_image',$has_image);
		$this->assign('data',$info);
		$this->assign('user',$user);
		$this->meta_title = "详细信息";
		$this->display();
	} 

	public function fblist($p = 1){
		$fb = M('feedback');

		$list = $fb->order("fd_time DESC")->page((int)$p,20)->select();
		$count = $fb->count();
		$page = new \Think\Page($count,20);
        $show = $page->show();

        $this->assign('list',$list);
        $this->assign('_page',$show);
        $this->meta_title = "反馈列表";
        $this->display();

	}

	public function fdpass($id){
		$id || $this->error('参数不足');

		if(M('feedback')->save(array('id'=>$id,'fd_status'=>1))){
			$this->success("已审核通过");
		}else{
			$this->error('审核失败，请重试');
		}
	}

	public function fdignore($id){
		$id || $this->error('参数不足');

		if(M('feedback')->save(array('id'=>$id,'fd_status'=>10))){
			$this->success("已忽略");
		}else{
			$this->error('操作失败，请重试');
		}
	}
}